package po;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Calendar;

public class SalePO implements Serializable {

	private static final long serialVersionUID = 1L;
	
	private int id;
	private String saleNumber;
	private Calendar time;
	private MemberPO member;
	private ArrayList<SaleItemPO> saleItem;
	private String address;
	private double price;
	
	public SalePO(int id, String saleNumber, Calendar time, MemberPO member,
			ArrayList<SaleItemPO> saleItem, String address, double price) {
		super();
		this.id = id;
		this.saleNumber = saleNumber;
		this.time = time;
		this.member = member;
		this.saleItem = saleItem;
		this.address = address;
		this.price = price;
	}
	
	public SalePO() {
		this.saleNumber = "";
		this.saleItem = new ArrayList<SaleItemPO>();
		this.address = "";
	}

	@Override
	public String toString() {
		return "SalePO [id=" + id + ", saleNumber=" + saleNumber + ", time="
				+ getTimeFormat() + ", member=" + member.getUsername() + ", saleItem=" + saleItem
				+ ", address=" + address + ", price=" + price + "]";
	}

	public int getId() {
		return id;
	}
	
	public String getSaleNumber() {
		return saleNumber;
	}
	
	public Calendar getTime() {
		return time;
	}
	
	public String getTimeFormat() {
		return time.get(Calendar.YEAR) + "-" + time.get(Calendar.MONTH) + 1 + "-" + time.get(Calendar.DATE);
	}
	
	public MemberPO getMember() {
		return member;
	}
	
	public ArrayList<SaleItemPO> getSaleItem() {
		return saleItem;
	}
	
	public String getAddress() {
		return address;
	}
	
	public double getPrice() {
		return price;
	}

}
